from PyQt5 import QtCore,QtWidgets,QtGui
from PyQt5.QtCore import QPoint,QRect
from PyQt5.QtWidgets import QWidget,QMainWindow,QLabel,QStyleOption,QStyle,QVBoxLayout,QHBoxLayout
from PyQt5.QtGui import QPainter,QColor,QPalette,QIcon
import lowmainres
import trayiconmenures
import upmainres
import centerwindres
from Q360Button import *
from Q360Label import *
class MainWindowswidlow(QWidget):
    def __init__(self,parent=None):
        super(MainWindowswidlow, self).__init__(parent)

        self.setMinimumSize(900,450)
        self.setMaximumSize(900,450)
        self.ispaint = False
        self.setStyleSheet("mainwindowswidlow{background-color:rgb(252,252,252)}")

    def paintEvent(self, a0: QtGui.QPaintEvent):
        opt = QStyleOption()
        opt.initFrom(self)
        painter = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget,opt,painter,self)

        p = QPainter(self)
        p.setPen(QColor(218,218,218))
        p.drawLine(QPoint(0,418),QPoint(900,418))

        if self.ispaint:
            p.setBrush(QColor(242,242,242))
            p.drawRect(0,418,900,600)

class MainWindowswidup(QWidget):
    def __init__(self,parent=None):
        super(MainWindowswidup, self).__init__(parent)
        self.setMinimumSize(900,150)
        self.setMaximumSize(900,150)
        self.setAutoFillBackground(True)
        self.setStyleSheet("mainwindowswidup{background:rgb(57,196,44);}")

        palette = QPalette()
        palette.setBrush(QPalette.Background,QColor(57,196,44))
        self.setPalette(palette)

        self.btnreturn = MainButton3(":/image/return.png",self)
        self.btnreturn.setGeometry(0,0,115,38)

    def paintEvent(self, a0: QtGui.QPaintEvent):
        opt = QStyleOption()
        opt.initFrom(self)
        painter = QPainter(self)
        self.style().drawPrimitive(QStyle.PE_Widget,opt,painter,self)


class AbstMainWidget(QWidget):
    def __init__(self,parent=None):
        super(AbstMainWidget, self).__init__(parent)

        self.lowwid = MainWindowswidlow(self)
        self.upwid = MainWindowswidup(self)

        vlayout = QVBoxLayout(self)
        vlayout.addWidget(self.upwid)
        vlayout.addWidget(self.lowwid)
        vlayout.setSpacing(0)
        vlayout.setContentsMargins(0,0,0,0)
        self.setLayout(vlayout)

        self.btnmini = MainButton3(":/image/min.png",self)
        self.btnexit = MainButton3(":/image/close.png", self)
        self.btnfeedback = MainButton3(":/image/feedback.png", self)
        self.btnmenu = MainButton3(":/image/Menu.png", self)
        self.btnskin = MainButton3(":/image/Skin.png", self)

        self.btnskin.setFixedSize(29,24)
        self.btnmini.setFixedSize(29,24)
        self.btnexit.setFixedSize(29,24)
        self.btnfeedback.setFixedSize(29,24)
        self.btnmenu.setFixedSize(29,24)

        hlayout = QHBoxLayout()
        hlayout.addWidget(self.btnskin)
        hlayout.addWidget(self.btnfeedback)
        hlayout.addWidget(self.btnmenu)
        hlayout.addWidget(self.btnmini)
        hlayout.addWidget(self.btnexit)
        hlayout.setSpacing(0)
        hlayout.setGeometry(QRect(750,0,145,24))
    def downwidget(self):
        return self.lowwid
    def topwidget(self):
        return self.upwid


class CsxfWidget(AbstMainWidget):
    def __init__(self,parent=None):
        super(CsxfWidget, self).__init__(parent)

        self.logo = QLabel(self.topwidget())
        self.logo.setStyleSheet("border-image:url(:/image/logo_normal.png)")
        self.logo.setGeometry(50,50,76,75)

        font2 = QFont()
        font2.setFamily("黑体")
        font2.setPixelSize(27)

        self.title = QLabel("您的电脑很安全",self.topwidget())
        self.title.setStyleSheet("color:white;font:24")
        self.title.setGeometry(150,60,400,32)
        self.title.setFont(font2)

        self.title2 = QLabel("定期木马查杀,漏洞修复,时刻保持电脑健康",self.topwidget())
        self.title2.setStyleSheet("color:white;")
        self.title2.setGeometry(150,92,400,32)

        self.btnstartscan = MainButton3(":/image/start_btn.png",self.topwidget())
        self.btnstartscan.setGeometry(700,50,164,64)

        self.btn1 = MainButton4(":/image/scan_button_quick_hover.png", ":/image/scan_button_quick.png", self.downwidget());
        self.btn1.setGeometry(140, 100, 140, 140);
        self.btn2 = MainButton4(":/image/scan_button_full_hover.png",":/image/scan_button_quick.png",self.downwidget())
        self.btn2.setGeometry(140,100,140,140)

        self.btn3 = MainButton4(":/image/scan_button_custom_hover.png",":/image/scan_button_custom.png",self.downwidget())
        self.btn3.setGeometry(620,100,140,140)

        self.labkssm = QLabel("快速扫描",self.downwidget())
        self.labqpsm = QLabel("全盘扫描",self.downwidget())
        self.labzdysm = QLabel("自定义扫描",self.downwidget())
        self.labkssm.setStyleSheet("color:rgb(68,68,68);font: 13pt 微软雅黑;")
        self.labqpsm.setStyleSheet("color:rgb(68,68,68);font: 13pt 微软雅黑;")
        self.labzdysm.setStyleSheet("color:rgb(68,68,68);font: 13pt 微软雅黑;")

        self.labkssm.setGeometry(175,250,150,24)
        self.labqpsm.setGeometry(415,250,150,24)
        self.labzdysm.setGeometry(650,250,150,24)

        self.btn4 = MainButton3(":/image/system_fix.png",self.downwidget())
        self.btn4.setGeometry(710,250,150,24)
        self.btn5 = MainButton3(":/image/system_fix.png",self.downwidget())
        self.btn5.setGeometry(800,310,60,60)

        self.labcgxu = QLabel("常规修复",self.downwidget())
        self.labldxf = QLabel("漏洞修复",self.downwidget())

        self.labcgxu.setStyleSheet("color:rgb(68,68,68);font: 14px 微软雅黑")
        self.labldxf.setStyleSheet("color:rgb(68,68,68);font: 14px 微软雅黑")
        self.labcgxu.setGeometry(710,380,80,30)
        self.labldxf.setGeometry(800,380,80,30)
        self.labcgxu.adjustSize()
        self.labldxf.adjustSize()


        self.lab = QLabel("已启用查杀引擎:",self.downwidget())
        self.lab.setStyleSheet("color:rgb(153,153,153)")
        self.lab.setGeometry(25,423,100,24)

        self.btndown1 = MainButton3(":/image/engStateBtnAvira.png",self.downwidget())
        self.btndown1.setGeometry(130,423,24,24)
        self.btndown2 = MainButton3(":/image/engStateBtnCloud.png",self.downwidget())
        self.btndown2.setGeometry(155,423,24,24)
        self.btndown3 = MainButton3(":/image/engStateBtnQEX.png", self.downwidget())
        self.btndown3.setGeometry(180, 423, 24, 24)
        self.btndown4 = MainButton3(":/image/engStateBtnQiFa.png", self.downwidget())
        self.btndown4.setGeometry(205, 423, 24, 24)
        self.btndown5 = MainButton3(":/image/engStateBtnQVM.png", self.downwidget())
        self.btndown5.setGeometry(230, 423, 24, 24)

        self.btndown6 = MainButton5(":/image/scan_setting.png","设置", self.downwidget())
        self.btndown6.setGeometry(700, 423, 50, 25)
        self.btndown7 = QPushButton("信任区", self.downwidget())
        self.btndown7.setGeometry(750, 423, 50, 24)
        self.btndown7.setStyleSheet("QPushButton{background:transparent;color: rgb(0,138,255);}"
                              "QPushButton::hover{color: rgb(0,180,255);}")

        self.btndown8 = QPushButton("恢复区",self.downwidget())
        self.btndown8.setGeometry(800,423,50,24)
        self.btndown8.setStyleSheet("QPushButton{background:transparent;color: rgb(0,138,255);}"
                              "QPushButton::hover{color: rgb(0,180,255);}")

        self.btndown9 = QPushButton("上报区",self.downwidget())
        self.btndown9.setGeometry(850,423,50,24)
        self.btndown9.setStyleSheet("QPushButton{background:transparent;color: rgb(0,138,255);}"
                              "QPushButton::hover{color: rgb(0,180,255);}")



class DnqlWidget(AbstMainWidget):
    def __init__(self,parent=None):
        super(DnqlWidget, self).__init__(parent)
        self.lablogo = QLabel(self.topwidget())
        self.lablogo.setStyleSheet("border-image:url(:/image/logo_clean.png)")
        self.lablogo.setGeometry(40,40,90,90)

        self.btnclean = MainButton3(":/image/btn_top_clean.png",self.topwidget())
        self.btnclean.setGeometry(700,50,164,64)

        font2 = QFont()
        font2.setFamily("黑体")
        font2.setPixelSize(27)

        self.title = QLabel("已经选择6项清理类型",self.topwidget())
        self.title.setStyleSheet("color:white;")
        self.title.setGeometry(150,60,400,32)
        self.title.setFont(font2)


        self.title2 = QLabel("经常清理,让电脑保持最轻松的状态",self.topwidget())
        self.title2.setStyleSheet("color:white;")
        self.title2.setGeometry(150,92,400,32)

        self.downwidget().ispaint = True
        self.downwidget().update()

        self.btnlow = QPushButton("经典版电脑清理", self.downwidget());
        self.btnlow1 = QPushButton("微信清理", self.downwidget());
        self.btnlow2 = QPushButton("苹果设备清理", self.downwidget());
        self.btnlow3 = QPushButton("系统盘瘦身", self.downwidget());

        self.btnlow4 = QPushButton("查找大文件", self.downwidget());
        self.btnlow5 = QPushButton("自动清理", self.downwidget());
        self.btnlow6 = QPushButton("恢复区", self.downwidget());

        self.btnlow.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow1.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow2.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");

        self.btnlow3.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow4.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow5.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow6.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");

        self.btnlow.setGeometry(15, 422, 100, 20);
        self.btnlow1.setGeometry(440, 422, 100, 20);
        self.btnlow2.setGeometry(515, 422, 100, 20);
        self.btnlow3.setGeometry(610, 422, 100, 20);
        self.btnlow4.setGeometry(690, 422, 100, 20);
        self.btnlow5.setGeometry(765, 422, 100, 20);
        self.btnlow6.setGeometry(825, 422, 100, 20);

        self.btnlow.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow1.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow2.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow3.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow4.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow5.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow6.setCursor(QtCore.Qt.PointingHandCursor);

        self.btnlow.adjustSize();
        self.btnlow1.adjustSize();
        self.btnlow2.adjustSize();
        self.btnlow3.adjustSize();
        self.btnlow4.adjustSize();
        self.btnlow5.adjustSize();
        self.btnlow6.adjustSize();

        self.btn = CleanMainButton(":/image/clean/clean_trash_check.png", ":/image/clean/clean_trash_uncheck.png"
                        , ":/image/clean/clean_trash_anim.png", ":/image/clean/clean_trash_aniself.gray.png", 13,
                        self.downwidget());
        self.btn.setGeometry(130, 60, 90, 90);

        self.btn1 = CleanMainButton(":/image/clean/clean_trace_check.png", ":/image/clean/clean_trace_uncheck.png"
                        , ":/image/clean/clean_trace_anim.png", ":/image/clean/clean_trace_anim_gray.png", 17,
                        self.downwidget());
        self.btn1.setGeometry(410, 60, 90, 90);

        self.btn2 = CleanMainButton(":/image/clean/clean_reg_check.png", ":/image/clean/clean_reg_uncheck.png"
                        , ":/image/clean/clean_reg_anim.png", ":/image/clean/clean_reg_anim_gray.png", 17,
                        self.downwidget());
        self.btn2.setGeometry(670, 60, 90, 90);

        self.btn3 = CleanMainButton(":/image/clean/clean_plugin_check.png", ":/image/clean/clean_plugin_uncheck.png"
                        , ":/image/clean/clean_plugin_anim.png", ":/image/clean/clean_plugin_anim_gray.png", 17,
                        self.downwidget());
        self.btn3.setGeometry(130, 230, 90, 90);

        self.btn4 = CleanMainButton(":/image/clean/clean_soft_check.png", ":/image/clean/clean_soft_uncheck.png"
                        , ":/image/clean/clean_soft_anim.png", ":/image/clean/clean_soft_anim_gray.png", 17,
                        self.downwidget());
        self.btn4.setGeometry(410, 230, 90, 90);

        self.btn5 = CleanMainButton(":/image/clean/clean_cookies_check.png", ":/image/clean/clean_cookies_uncheck.png"
                        , ":/image/clean/clean_cookies_anim.png", ":/image/clean/clean_cookies_anim_gray.png", 20,
                        self.downwidget());
        self.btn5.setGeometry(670, 230, 90, 90);


        font = QFont()
        font.setFamily("宋体");
        font.setBold(True);
        font.setPixelSize(16);
        self.labqllj = QLabel("清理垃圾", self.downwidget());
        self.labqlhj = QLabel("清理痕迹", self.downwidget());
        self.labqlzcb = QLabel("清理注册表", self.downwidget());
        self.labqlcj = QLabel("清理插件", self.downwidget());
        self.labqlrj = QLabel("清理软件", self.downwidget());
        self.labqlcookies = QLabel("清理Cookies", self.downwidget());


        self.labqllj.setStyleSheet("color:rgb(102,102,102);");
        self.labqlhj.setStyleSheet("color:rgb(102,102,102);");
        self.labqlzcb.setStyleSheet("color:rgb(102,102,102);");
        self.labqlcj.setStyleSheet("color:rgb(102,102,102);");
        self.labqlrj.setStyleSheet("color:rgb(102,102,102);");
        self.labqlcookies.setStyleSheet("color:rgb(102,102,102);");

        self.labqllj.setFont(font);
        self.labqlhj.setFont(font);
        self.labqlzcb.setFont(font);
        self.labqlcj.setFont(font);
        self.labqlrj.setFont(font);
        self.labqlcookies.setFont(font);

        self.labqllj.setGeometry(140, 150, 110, 60);
        self.labqlhj.setGeometry(420, 150, 110, 60);
        self.labqlzcb.setGeometry(675, 150, 110, 60);
        self.labqlcj.setGeometry(140, 320, 110, 60);
        self.labqlrj.setGeometry(420, 320, 110, 60);
        self.labqlcookies.setGeometry(675, 320, 110, 60);

        self.labqllj.adjustSize();
        self.labqlhj.adjustSize();
        self.labqlzcb.adjustSize();
        self.labqlcj.adjustSize();
        self.labqlrj.adjustSize();
        self.labqlcookies.adjustSize();

        self.lab0 = QLabel("清理电脑中的垃圾文件", self.downwidget());
        self.lab1 = QLabel("清理浏览器使用痕迹", self.downwidget());
        self.lab2 = QLabel("清理无效的注册表项目", self.downwidget());
        self.lab3 = QLabel("清理无用的插件,降低打扰", self.downwidget());
        self.lab4 = QLabel("清理推广,弹窗不常用的软件", self.downwidget());
        self.lab5 = QLabel("清理上网,游戏,购物等记录", self.downwidget());


        self.lab0.setStyleSheet("color:rgb(124,124,124);");
        self.lab1.setStyleSheet("color:rgb(124,124,124);");
        self.lab2.setStyleSheet("color:rgb(124,124,124);");
        self.lab3.setStyleSheet("color:rgb(124,124,124);");
        self.lab4.setStyleSheet("color:rgb(124,124,124);");
        self.lab5.setStyleSheet("color:rgb(124,124,124);");

        self.lab0.setGeometry(115, 175, 150, 60);
        self.lab1.setGeometry(400, 175, 150, 60);
        self.lab2.setGeometry(655, 175, 150, 60);
        self.lab3.setGeometry(100, 345, 150, 60);
        self.lab4.setGeometry(385, 345, 150, 60);
        self.lab5.setGeometry(650, 345, 150, 60);

        self.lab0.adjustSize();
        self.lab1.adjustSize();
        self.lab2.adjustSize();
        self.lab3.adjustSize();
        self.lab4.adjustSize();
        self.lab5.adjustSize();


class YhjsWidget(AbstMainWidget):
    def __init__(self,parent=None):
        super(YhjsWidget, self).__init__(parent)
        self.btnkjjs = CheckButton(":/image/start_check.png", ":/image/start_uncheck.png", self.downwidget());
        self.btnxtjs = CheckButton(":/image/sys_check.png", ":/image/sys_uncheck.png", self.downwidget());
        self.btnwljs = CheckButton(":/image/net_check.png", ":/image/net_uncheck.png", self.downwidget());
        self.btnypjs = CheckButton(":/image/disk_check.png", ":/image/disk_uncheck.png", self.downwidget());

        self.btnkjjs.setGeometry(55, 80, 150, 150);
        self.btnxtjs.setGeometry(265, 80, 150, 150);
        self.btnwljs.setGeometry(475, 80, 150, 150);
        self.btnypjs.setGeometry(685, 80, 150, 150);

        font = QFont()
        font.setFamily("宋体")
        font.setBold(True)
        font.setPixelSize(16)
        self.labkjjs = QLabel("开机加速", self.downwidget());
        self.labxtjs = QLabel("系统加速", self.downwidget());
        self.labwljs = QLabel("网络加速", self.downwidget());
        self.labypjs = QLabel("硬盘加速", self.downwidget());
        self.labkjjs.setStyleSheet("color:rgb(102,102,102);");
        self.labxtjs.setStyleSheet("color:rgb(102,102,102);");
        self.labwljs.setStyleSheet("color:rgb(102,102,102);");
        self.labypjs.setStyleSheet("color:rgb(102,102,102);");

        self.labkjjs.setFont(font);
        self.labxtjs.setFont(font);
        self.labwljs.setFont(font);
        self.labypjs.setFont(font);

        self.labkjjs.setFixedSize(150, 60);
        self.labxtjs.setFixedSize(150, 60);
        self.labwljs.setFixedSize(150, 60);
        self.labypjs.setFixedSize(150, 60);

        self.labkjjs.setGeometry(100, 240, 150, 60);
        self.labxtjs.setGeometry(310, 240, 150, 60);
        self.labwljs.setGeometry(520, 240, 150, 60);
        self.labypjs.setGeometry(730, 240, 150, 60);

        self.labkjjs2 = QLabel("优化软件自启动状态", self.downwidget());
        self.labxtjs2 = QLabel("优化系统和内存设置", self.downwidget());
        self.labwljs2 = QLabel("优化网络配置与性能", self.downwidget());
        self.labypjs2 = QLabel("优化硬盘传输效率", self.downwidget());
        self.labkjjs2.setStyleSheet("color:rgb(124,124,124);");
        self.labxtjs2.setStyleSheet("color:rgb(124,124,124);");
        self.labwljs2.setStyleSheet("color:rgb(124,124,124);");
        self.labypjs2.setStyleSheet("color:rgb(124,124,124);");

        self.labkjjs2.setGeometry(80, 270, 150, 60);
        self.labxtjs2.setGeometry(290, 270, 150, 60);
        self.labwljs2.setGeometry(500, 270, 150, 60);
        self.labypjs2.setGeometry(715, 270, 150, 60);

        self.logo = QLabel(self.topwidget());
        self.logo.setStyleSheet("border-image:url(:/image/logo_speed.png)");
        self.logo.setGeometry(50, 50, 76, 75);


        font2 = QFont()
        font2.setFamily("黑体");
        font2.setPixelSize(27);

        self.title = QLabel("一键优化，让电脑快如闪电!", self.topwidget());
        self.title.setStyleSheet("color:white;font:24");
        self.title.setGeometry(150, 60, 400, 32);
        self.title.setFont(font2);

        self.title2 = QLabel("全面提升电脑开机速度,系统速度,上网速度,硬盘速度", self.topwidget());
        self.title2.setStyleSheet("color:white;");
        self.title2.setGeometry(150, 92, 400, 32);

        self.btnstartscan = MainButton3(":/image/btn_start_scan.png", self.topwidget());
        self.btnstartscan.setGeometry(700, 50, 164, 64);

        self.btnlow = QPushButton("启动项(70)", self.downwidget());
        self.btnlow1 = QPushButton("开机时间", self.downwidget());
        self.btnlow2 = QPushButton("已忽略(5)", self.downwidget());
        self.btnlow3 = QPushButton("优化记录(50)", self.downwidget());

        self.btnlow.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow1.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow2.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");
        self.btnlow3.setStyleSheet("QPushButton::hover{color:rgb(36,147,229,180)}"
                                 "QPushButton{background:transparent;color: rgb(36,147,229)}");

        self.btnlow.setIcon(QIcon(QPixmap(":/image/yhjs_down1.png")));
        self.btnlow1.setIcon(QIcon(QPixmap(":/image/yhjs_down2.png")));

        self.btnlow.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow1.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow2.setCursor(QtCore.Qt.PointingHandCursor);
        self.btnlow3.setCursor(QtCore.Qt.PointingHandCursor);

        self.btnlow.setGeometry(540, 425, 85, 20);
        self.btnlow1.setGeometry(630, 425, 85, 20);
        self.btnlow2.setGeometry(725, 425, 55, 20);
        self.btnlow3.setGeometry(795, 425, 75, 20);

class LowMainWindow(QMainWindow):
    def __init__(self,parent=None):
        super(LowMainWindow, self).__init__(parent)
        self.setStyleSheet("QMainWindow{background:white;}")
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setMaximumSize(900,160)
        self.setMinimumSize(900,160)

        self.btn = MainButton(":/image/safe.png",":/image/safe_Hover.png",":/image/safe_Leave.png",self)
        self.btn.setGeometry(30,30,95,95)

        self.label = QLabel(self)
        self.label.setStyleSheet("background-image:url(:/image/csxf.png)")
        self.label.setGeometry(45,130,70,20)

        self.btn1 = MainButton(":/image/clean.png",":/image/clean_Hover.png",":/image/clean_Leave.png",self)
        self.btn1.setGeometry(140,30,95,95)

        self.label1 = QLabel(self)
        self.label1.setStyleSheet("background-image:url(:/image/dnql.png)")
        self.label1.setGeometry(155,130,70,20)

        self.btn2 = MainButton(":/image/youhua.png",":/image/youhua_Hover.png",":/image/youhua_Leave.png",self)
        self.btn2.setGeometry(250,30,95,95)
        self.label2 = QLabel(self)
        self.label2.setStyleSheet("background-image:url(:/image/yhjs.png)")
        self.label2.setGeometry(265,130,70,20)

        self.btn3 = MainButton2(":/image/rjgj.png", "软件管家", self);
        self.btn4 = MainButton2(":/image/rgfw.png", "人工服务", self);
        self.btn5 = MainButton2(":/image/kdcsq.png", "宽带测速器", self);
        self.btn6 = MainButton2(":/image/360wd.png", "360问答", self);
        self.btn3.setFixedSize(76, 70);
        self.btn4.setFixedSize(76, 70);
        self.btn5.setFixedSize(76, 70);
        self.btn6.setFixedSize(76, 70);

        hlay = QHBoxLayout(self)
        hlay.addWidget(self.btn3)
        hlay.addWidget(self.btn4)
        hlay.addWidget(self.btn5)
        hlay.addWidget(self.btn6)
        hlay.setSpacing(0)
        hlay.setGeometry(QRect(525,80,304,70))

        self.btn7 = QPushButton(self)
        self.btn7.setGeometry(840,92,32,32)
        self.btn8 = QPushButton(self)
        self.btn8.setGeometry(842,128,32,24)
        self.btn8.setCursor(QtCore.Qt.PointingHandCursor)
        self.btn8.setStyleSheet("QPushButton{background:transparent;color:rgb(0,135,255);}")
        self.btn8.setText("更多")

        self.btn9 = QPushButton(self)
        self.btn9.setGeometry(701,30,173,32)
        self.btn9.setCursor(QtCore.Qt.PointingHandCursor)
        self.btn9.setStyleSheet("QPushButton{background:transparent;border-image:url(:/image/win10_normal.png);}"
                              "QPushButton::hover{border-image:url(:/image/win10_hover.png);}"
                              "QPushButton::pressed{border-image:url(:/image/win10_pressed.png);}");



class UpMainWindow(QMainWindow):
    def __init__(self,parent=None):
        super(UpMainWindow, self).__init__(parent)
        self.setMinimumSize(900, 440);
        self.setMaximumSize(900, 440);
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint);
        self.setStyleSheet("QMainWindow{background:rgb(57,196,44);}QLabel{background:transparent;color:white;} QPushButton{background:transparent}");
        self.MousePressed = False
        self.logolabel = QLabel(self)
        self.logolabel.setGeometry(10, 5, 16, 16);
        self.logolabel.setStyleSheet("border-image:url(:/image/360logo.png)");

        self.titlelabel = QLabel("360安全卫士领航版", self);
        self.titlelabel.setGeometry(30, 5, 105, 16);

        self.btnupdate = MainButton3(":/image/update_btn.png", self);
        self.btnupdate.setGeometry(135, 5, 16, 16);

        self.btnmini = MainButton3(":/image/min.png", self);
        self.btnexit = MainButton3(":/image/close.png", self);
        self.btnfeedback = MainButton3(":/image/feedback.png", self);
        self.btnmenu = MainButton3(":/image/Menu.png", self);
        self.btnskin = MainButton3(":/image/Skin.png", self);

        self.btnskin.setFixedSize(29, 24);
        self.btnmini.setFixedSize(29, 24);
        self.btnexit.setFixedSize(29, 24);
        self.btnfeedback.setFixedSize(29, 24);
        self.btnmenu.setFixedSize(29, 24);

        hlyout = QHBoxLayout(self);
        hlyout.addWidget(self.btnskin);
        hlyout.addWidget(self.btnfeedback);
        hlyout.addWidget(self.btnmenu);
        hlyout.addWidget(self.btnmini);
        hlyout.addWidget(self.btnexit);
        hlyout.setSpacing(0);
        hlyout.setGeometry(QRect(750, 0, 145, 24));

        self.labscore = Q360Label(":/image/100.png", self);
        self.labscore.setGeometry(30, 85, 191, 191);


        font2 = QFont()
        font2.setFamily("黑体");
        font2.setPixelSize(36);

        self.title = QLabel("上次电脑体检良好,请继续保持！", self);
        self.title.setStyleSheet("color:white;");
        self.title.setGeometry(240, 150, 600, 40);
        self.title.setFont(font2);

        self.title2 = QLabel("上次体检是1分钟以前,共发现5个问题,已全部处理", self);
        self.title2.setStyleSheet("color:white;font-size:14px;");
        self.title2.setGeometry(240, 200, 400, 32);

        self.btnhead = HeadButton(self);
        self.btnhead.setGeometry(840, 50, 52, 52);

        self.btnword = WordsLineButton("登录360帐号", self);
        self.btnword.setGeometry(760, 70, 80, 20);

        self.btnexamine = MainButton3(":/image/btn_examine_now.png", self);
        self.btnexamine.setGeometry(344, 285, 212, 74);

        self.btnsecurity = QPushButton(self);
        self.btnsecurity.setGeometry(50, 360, 37, 37);
        self.btnsecurity.setStyleSheet("QPushButton{border-image:url(:/image/security_safe_normal.png)}"
                                     "QPushButton::hover{border-image:url(:/image/security_safe_hover.png)}");
        self.btnsecurity.setCursor(QtCore.Qt.PointingHandCursor);

        self.security = QLabel("安全防护中心", self);
        self.security.setGeometry(30, 400, 100, 16);

        label = QLabel(self);
        label.setGeometry(120, 360, 1, 50);
        label.setStyleSheet("background:transparent;border-image:url(:/image/guardline.png);");

        self.payfor = QLabel("网购先陪", self);
        self.payfor.setGeometry(145, 400, 60, 16);
        self.btnnetpayfor = QPushButton(self);
        self.btnnetpayfor.setGeometry(150, 360, 37, 37);
        self.btnnetpayfor.setStyleSheet("QPushButton{border-image:url(:/image/payinsure_safe_normal.png)}"
                                      "QPushButton::hover{border-image:url(:/image/payinsure_safe_hover.png)}");
        self.btnnetpayfor.setCursor(QtCore.Qt.PointingHandCursor);

    def mousePressEvent(self, a0: QtGui.QMouseEvent):
        if a0.button() == QtCore.Qt.LeftButton:
            mainwin = self.parentWidget().parentWidget()
            self.windowpos = mainwin.pos()
            self.mousepos = a0.globalPos()
            self.MousePressed = True
    def mouseMoveEvent(self, a0: QtGui.QMouseEvent):
        if self.MousePressed:
            mainwin = self.parentWidget().parentWidget()
            mainwin.move(self.windowpos + (a0.globalPos() - self.mousepos))
    def mouseReleaseEvent(self, a0: QtGui.QMouseEvent):
        if a0.button() == QtCore.Qt.LeftButton:
            self.MousePressed = False

class MaskMainWidget(QWidget):
    def __init__(self,parent=None):
        super(MaskMainWidget, self).__init__(parent)
        self.setMaximumSize(900,600)
        self.setMinimumSize(900,600)
        self.upmain = UpMainWindow(self)
        self.lowmain = LowMainWindow(self)
        h = self.upmain.width()
        w = self.upmain.height()
        self.upmain.setGeometry(0,0,self.upmain.width(),self.upmain.height())
        self.lowmain.setGeometry(0,440,self.lowmain.width(),self.lowmain.height())











